package kube

import (
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func (c *Client) ListNodes(option *metav1.ListOptions) (*corev1.NodeList, error) {
	if option == nil {
		option = &metav1.ListOptions{}
	}

	list, err := c.ClientSet.CoreV1().Nodes().List(c.Ctx, *option)
	if err != nil {
		return nil, err
	}
	return list, nil
}

func (c *Client) GetPod(namespace, name string) (*corev1.Pod, error) {
	pod, err := c.ClientSet.CoreV1().Pods(namespace).Get(c.Ctx, name, metav1.GetOptions{})
	if err != nil {
		return nil, err
	}
	return pod, nil
}
